package kr.co.spring329.sample.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import kr.co.spring329.sample.dao.ScheduleJobListDao;
import kr.co.spring329.sample.model.ScheduleJobListVO;

@Service
public class ScheduleJobListService
{
	@Autowired
	private ScheduleJobListDao scheduleJobListDao;
	
	
	/**
	 * 서버 호스트 네임 반환
	 * @return
	 * @throws Exception
	 */
	public String getServerHostName() throws Exception
	{
		return this.scheduleJobListDao.getServerHostName();
	}
	
	/**
	 * 서버 호스트 네임 업데이트
	 * @param hostName
	 * @return
	 * @throws Exception
	 */
	@Transactional(propagation=Propagation.REQUIRED, rollbackFor=Exception.class)
	public int updateServerHostName(String hostName) throws Exception
	{
		return this.scheduleJobListDao.updateServerHostName(hostName);
	}
	
	/**
	 * schedulejoblist 리스트 반환
	 * @return
	 * @throws Exception
	 */
	public List<ScheduleJobListVO> listJobList() throws Exception
	{
		return this.scheduleJobListDao.listJobList();
	}
	
	/**
	 * cronExpression 업데이트
	 * @param scheduleJobListVO
	 * @return
	 * @throws Exception
	 */
	@Transactional(propagation=Propagation.REQUIRED, rollbackFor=Exception.class)
	public int updateCronExpression(ScheduleJobListVO scheduleJobListVO) throws Exception
	{
		return this.scheduleJobListDao.updateCronExpression(scheduleJobListVO);
	}
}
























